package com.rock.code.bigdata.targets.controller;

import com.github.pagehelper.PageInfo;
import com.rock.code.base.controller.BaseController;
import com.rock.code.bigdata.targets.domain.TbSysTarget;
import com.rock.code.bigdata.targets.service.TbSysTargetService;
import com.rock.code.common.exceptions.SystemException;
import com.rock.code.common.pager.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author piandu
 * @description 指标
 * @date 2018/10/12 16/34
 */
@Controller
@RequestMapping("/KpiTargetData")
public class TbSysTragetController extends BaseController {

    @Resource
    private TbSysTargetService tbSysTargetServiceImpl;

    /**
     * queryPageListTarget
     * 指标展示
     *
     * @return the page info
     * @throws Exception the exception
     */
    @ResponseBody
    @RequestMapping(value = "/queryPageListTarget", method = RequestMethod.POST)
    public PageInfo<TbSysTarget> queryPageListType() throws Exception {
        Map<String, Object> param = this.getRequestMapSingle();
        Page page = new Page(request);
        PageInfo pageInfo = null;
        try {
            pageInfo = tbSysTargetServiceImpl.queryPageListTarget(page, param);
        } catch (Exception e) {
            e.printStackTrace();
            throw new SystemException(e);
        }
        return pageInfo;
    }



    /**
     * queryPageListTarget1
     * top指标展示
     *
     * @return the page info
     * @throws Exception the exception
     */
    @ResponseBody
    @RequestMapping(value = "/queryPageListTarget1", method = RequestMethod.POST)
    public PageInfo<TbSysTarget> queryPageListType1() throws Exception {
        Map<String, Object> param = this.getRequestMapSingle();
        Page page = new Page(request);
        PageInfo pageInfo = null;
        try {
            pageInfo = tbSysTargetServiceImpl.queryPageListTarget1(page, param);
        } catch (Exception e) {
            e.printStackTrace();
            throw new SystemException(e);
        }
        return pageInfo;
    }
}
